package com.jc.ds.model;

/**
 * role
 * @author 
 */
public class Role extends BaseValueObject {
    private Long id;

    private String name;

    private String description;

    private String orderStr = null;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void orderById(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by id asc";
            }else{
                this.orderStr = this.orderStr + ",id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by id desc";
            }else{
                this.orderStr = this.orderStr + ",id desc";
            }
        }
    }

    public void orderByName(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by name asc";
            }else{
                this.orderStr = this.orderStr + ",name asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by name desc";
            }else{
                this.orderStr = this.orderStr + ",name desc";
            }
        }
    }

    public void orderByDescription(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by description asc";
            }else{
                this.orderStr = this.orderStr + ",description asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by description desc";
            }else{
                this.orderStr = this.orderStr + ",description desc";
            }
        }
    }
}